package com.tuozixuan;

import java.io.File;

import org.eclipse.jgit.api.Git;
import org.eclipse.jgit.transport.UsernamePasswordCredentialsProvider;
import static com.tuozixuan.GitDemoConstants.*;

public class GitPullDemo {

	public static void main(String[] args) throws Exception {
		
		UsernamePasswordCredentialsProvider provider = new UsernamePasswordCredentialsProvider(USERNAME, PASSWORD);
		
		// 拉取远程更新
		Git git = Git.open(new File(LOCAL_DIR));
		git.pull().setCredentialsProvider(provider).setRemoteBranchName("master").call();
	}

}
